# -*- coding: UTF-8 -*-
import openpyxl


class ExcelHelper(object):
    def __init__(self, fileName, sheetName):
        self.wb = openpyxl.load_workbook(filename=fileName, read_only=True)
        self.ws = self.wb[sheetName]

    def get_data_list(self):
        min_row = self.ws.min_row
        max_row = self.ws.max_row
        min_column = self.ws.min_column
        max_column = self.ws.max_column

        row_datas = []
        rows_count = max_row - min_row + 1
        print("文件总数据行："+str(rows_count))
        for row in self.ws.iter_rows(min_row=min_row, min_col=min_column, max_row=max_row, max_col=max_column):
            row_data = []
            for cell in row:
                row_data.append(cell.value)
            row_datas.append(row_data)
        return row_datas
